
/*
'===============================================================================
'  Generated From - CSharp_dOOdads_BusinessEntity.vbgen
' 
'  ** IMPORTANT  ** 
'  How to Generate your stored procedures:
' 
'  SQL        = SQL_StoredProcs.vbgen
'  ACCESS     = Access_StoredProcs.vbgen
'  ORACLE     = Oracle_StoredProcs.vbgen
'  FIREBIRD   = FirebirdStoredProcs.vbgen
'  POSTGRESQL = PostgreSQL_StoredProcs.vbgen
'
'  The supporting base class SqlClientEntity is in the Architecture directory in "dOOdads".
'  
'  This object is 'abstract' which means you need to inherit from it to be able
'  to instantiate it.  This is very easilly done. You can override properties and
'  methods in your derived class, this allows you to regenerate this class at any
'  time and not worry about overwriting custom code. 
'
'  NEVER EDIT THIS FILE.
'
'  public class YourObject :  _YourObject
'  {
'
'  }
'
'===============================================================================
*/

// Generated by MyGeneration Version # (1.1.5.1)

using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
using System.Collections.Specialized;

using MyGeneration.dOOdads;

namespace FrioAereo.Entities.SisitemaOperaciones
{
	public abstract class _Usuarios : SqlClientEntity
	{
		public _Usuarios()
		{
			this.QuerySource = "Usuarios";
			this.MappingName = "Usuarios";

		}	

		//=================================================================
		//  public Overrides void AddNew()
		//=================================================================
		//
		//=================================================================
		public override void AddNew()
		{
			base.AddNew();
			
		}
		
		
		public override void FlushData()
		{
			this._whereClause = null;
			this._aggregateClause = null;
			base.FlushData();
		}
		
		//=================================================================
		//  	public Function LoadAll() As Boolean
		//=================================================================
		//  Loads all of the records in the database, and sets the currentRow to the first row
		//=================================================================
		public bool LoadAll() 
		{
			ListDictionary parameters = null;
			
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_UsuariosLoadAll]", parameters);
		}
	
		//=================================================================
		// public Overridable Function LoadByPrimaryKey()  As Boolean
		//=================================================================
		//  Loads a single row of via the primary key
		//=================================================================
		public virtual bool LoadByPrimaryKey()
		{
			ListDictionary parameters = new ListDictionary();
					
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_UsuariosLoadByPrimaryKey]", parameters);
		}
		
		#region Parameters
		protected class Parameters
		{
			
			public static SqlParameter Id_usr
			{
				get
				{
					return new SqlParameter("@Id_usr", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter Des_usr
			{
				get
				{
					return new SqlParameter("@Des_usr", SqlDbType.NVarChar, 50);
				}
			}
			
			public static SqlParameter Grp_usr
			{
				get
				{
					return new SqlParameter("@Grp_usr", SqlDbType.NVarChar, 50);
				}
			}
			
			public static SqlParameter Nom_usr
			{
				get
				{
					return new SqlParameter("@Nom_usr", SqlDbType.NVarChar, 50);
				}
			}
			
			public static SqlParameter Estado
			{
				get
				{
					return new SqlParameter("@Estado", SqlDbType.Bit, 0);
				}
			}
			
		}
		#endregion		
	
		#region ColumnNames
		public class ColumnNames
		{  
            public const string Id_usr = "Id_usr";
            public const string Des_usr = "Des_usr";
            public const string Grp_usr = "Grp_usr";
            public const string Nom_usr = "Nom_usr";
            public const string Estado = "Estado";

			static public string ToPropertyName(string columnName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[Id_usr] = _Usuarios.PropertyNames.Id_usr;
					ht[Des_usr] = _Usuarios.PropertyNames.Des_usr;
					ht[Grp_usr] = _Usuarios.PropertyNames.Grp_usr;
					ht[Nom_usr] = _Usuarios.PropertyNames.Nom_usr;
					ht[Estado] = _Usuarios.PropertyNames.Estado;

				}
				return (string)ht[columnName];
			}

			static private Hashtable ht = null;			 
		}
		#endregion
		
		#region PropertyNames
		public class PropertyNames
		{  
            public const string Id_usr = "Id_usr";
            public const string Des_usr = "Des_usr";
            public const string Grp_usr = "Grp_usr";
            public const string Nom_usr = "Nom_usr";
            public const string Estado = "Estado";

			static public string ToColumnName(string propertyName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[Id_usr] = _Usuarios.ColumnNames.Id_usr;
					ht[Des_usr] = _Usuarios.ColumnNames.Des_usr;
					ht[Grp_usr] = _Usuarios.ColumnNames.Grp_usr;
					ht[Nom_usr] = _Usuarios.ColumnNames.Nom_usr;
					ht[Estado] = _Usuarios.ColumnNames.Estado;

				}
				return (string)ht[propertyName];
			}

			static private Hashtable ht = null;			 
		}			 
		#endregion	

		#region StringPropertyNames
		public class StringPropertyNames
		{  
            public const string Id_usr = "s_Id_usr";
            public const string Des_usr = "s_Des_usr";
            public const string Grp_usr = "s_Grp_usr";
            public const string Nom_usr = "s_Nom_usr";
            public const string Estado = "s_Estado";

		}
		#endregion		
		
		#region Properties
	
		public virtual int Id_usr
	    {
			get
	        {
				return base.Getint(ColumnNames.Id_usr);
			}
			set
	        {
				base.Setint(ColumnNames.Id_usr, value);
			}
		}

		public virtual string Des_usr
	    {
			get
	        {
				return base.Getstring(ColumnNames.Des_usr);
			}
			set
	        {
				base.Setstring(ColumnNames.Des_usr, value);
			}
		}

		public virtual string Grp_usr
	    {
			get
	        {
				return base.Getstring(ColumnNames.Grp_usr);
			}
			set
	        {
				base.Setstring(ColumnNames.Grp_usr, value);
			}
		}

		public virtual string Nom_usr
	    {
			get
	        {
				return base.Getstring(ColumnNames.Nom_usr);
			}
			set
	        {
				base.Setstring(ColumnNames.Nom_usr, value);
			}
		}

		public virtual bool Estado
	    {
			get
	        {
				return base.Getbool(ColumnNames.Estado);
			}
			set
	        {
				base.Setbool(ColumnNames.Estado, value);
			}
		}


		#endregion
		
		#region String Properties
	
		public virtual string s_Id_usr
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Id_usr) ? string.Empty : base.GetintAsString(ColumnNames.Id_usr);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Id_usr);
				else
					this.Id_usr = base.SetintAsString(ColumnNames.Id_usr, value);
			}
		}

		public virtual string s_Des_usr
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Des_usr) ? string.Empty : base.GetstringAsString(ColumnNames.Des_usr);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Des_usr);
				else
					this.Des_usr = base.SetstringAsString(ColumnNames.Des_usr, value);
			}
		}

		public virtual string s_Grp_usr
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Grp_usr) ? string.Empty : base.GetstringAsString(ColumnNames.Grp_usr);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Grp_usr);
				else
					this.Grp_usr = base.SetstringAsString(ColumnNames.Grp_usr, value);
			}
		}

		public virtual string s_Nom_usr
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Nom_usr) ? string.Empty : base.GetstringAsString(ColumnNames.Nom_usr);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Nom_usr);
				else
					this.Nom_usr = base.SetstringAsString(ColumnNames.Nom_usr, value);
			}
		}

		public virtual string s_Estado
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Estado) ? string.Empty : base.GetboolAsString(ColumnNames.Estado);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Estado);
				else
					this.Estado = base.SetboolAsString(ColumnNames.Estado, value);
			}
		}


		#endregion		
	
		#region Where Clause
		public class WhereClause
		{
			public WhereClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffWhereParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffWhereParameter(this);
					}

					return _tearOff;
				}
			}

			#region WhereParameter TearOff's
			public class TearOffWhereParameter
			{
				public TearOffWhereParameter(WhereClause clause)
				{
					this._clause = clause;
				}
				
				
				public WhereParameter Id_usr
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Id_usr, Parameters.Id_usr);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Des_usr
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Des_usr, Parameters.Des_usr);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Grp_usr
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Grp_usr, Parameters.Grp_usr);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Nom_usr
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Nom_usr, Parameters.Nom_usr);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Estado
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Estado, Parameters.Estado);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}


				private WhereClause _clause;
			}
			#endregion
		
			public WhereParameter Id_usr
		    {
				get
		        {
					if(_Id_usr_W == null)
	        	    {
						_Id_usr_W = TearOff.Id_usr;
					}
					return _Id_usr_W;
				}
			}

			public WhereParameter Des_usr
		    {
				get
		        {
					if(_Des_usr_W == null)
	        	    {
						_Des_usr_W = TearOff.Des_usr;
					}
					return _Des_usr_W;
				}
			}

			public WhereParameter Grp_usr
		    {
				get
		        {
					if(_Grp_usr_W == null)
	        	    {
						_Grp_usr_W = TearOff.Grp_usr;
					}
					return _Grp_usr_W;
				}
			}

			public WhereParameter Nom_usr
		    {
				get
		        {
					if(_Nom_usr_W == null)
	        	    {
						_Nom_usr_W = TearOff.Nom_usr;
					}
					return _Nom_usr_W;
				}
			}

			public WhereParameter Estado
		    {
				get
		        {
					if(_Estado_W == null)
	        	    {
						_Estado_W = TearOff.Estado;
					}
					return _Estado_W;
				}
			}

			private WhereParameter _Id_usr_W = null;
			private WhereParameter _Des_usr_W = null;
			private WhereParameter _Grp_usr_W = null;
			private WhereParameter _Nom_usr_W = null;
			private WhereParameter _Estado_W = null;

			public void WhereClauseReset()
			{
				_Id_usr_W = null;
				_Des_usr_W = null;
				_Grp_usr_W = null;
				_Nom_usr_W = null;
				_Estado_W = null;

				this._entity.Query.FlushWhereParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffWhereParameter _tearOff;
			
		}
	
		public WhereClause Where
		{
			get
			{
				if(_whereClause == null)
				{
					_whereClause = new WhereClause(this);
				}
		
				return _whereClause;
			}
		}
		
		private WhereClause _whereClause = null;	
		#endregion
	
		#region Aggregate Clause
		public class AggregateClause
		{
			public AggregateClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffAggregateParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffAggregateParameter(this);
					}

					return _tearOff;
				}
			}

			#region AggregateParameter TearOff's
			public class TearOffAggregateParameter
			{
				public TearOffAggregateParameter(AggregateClause clause)
				{
					this._clause = clause;
				}
				
				
				public AggregateParameter Id_usr
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Id_usr, Parameters.Id_usr);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Des_usr
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Des_usr, Parameters.Des_usr);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Grp_usr
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Grp_usr, Parameters.Grp_usr);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Nom_usr
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Nom_usr, Parameters.Nom_usr);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Estado
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Estado, Parameters.Estado);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}


				private AggregateClause _clause;
			}
			#endregion
		
			public AggregateParameter Id_usr
		    {
				get
		        {
					if(_Id_usr_W == null)
	        	    {
						_Id_usr_W = TearOff.Id_usr;
					}
					return _Id_usr_W;
				}
			}

			public AggregateParameter Des_usr
		    {
				get
		        {
					if(_Des_usr_W == null)
	        	    {
						_Des_usr_W = TearOff.Des_usr;
					}
					return _Des_usr_W;
				}
			}

			public AggregateParameter Grp_usr
		    {
				get
		        {
					if(_Grp_usr_W == null)
	        	    {
						_Grp_usr_W = TearOff.Grp_usr;
					}
					return _Grp_usr_W;
				}
			}

			public AggregateParameter Nom_usr
		    {
				get
		        {
					if(_Nom_usr_W == null)
	        	    {
						_Nom_usr_W = TearOff.Nom_usr;
					}
					return _Nom_usr_W;
				}
			}

			public AggregateParameter Estado
		    {
				get
		        {
					if(_Estado_W == null)
	        	    {
						_Estado_W = TearOff.Estado;
					}
					return _Estado_W;
				}
			}

			private AggregateParameter _Id_usr_W = null;
			private AggregateParameter _Des_usr_W = null;
			private AggregateParameter _Grp_usr_W = null;
			private AggregateParameter _Nom_usr_W = null;
			private AggregateParameter _Estado_W = null;

			public void AggregateClauseReset()
			{
				_Id_usr_W = null;
				_Des_usr_W = null;
				_Grp_usr_W = null;
				_Nom_usr_W = null;
				_Estado_W = null;

				this._entity.Query.FlushAggregateParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffAggregateParameter _tearOff;
			
		}
	
		public AggregateClause Aggregate
		{
			get
			{
				if(_aggregateClause == null)
				{
					_aggregateClause = new AggregateClause(this);
				}
		
				return _aggregateClause;
			}
		}
		
		private AggregateClause _aggregateClause = null;	
		#endregion
	
		protected override IDbCommand GetInsertCommand() 
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_UsuariosInsert]";
	
			CreateParameters(cmd);
			    
			return cmd;
		}
	
		protected override IDbCommand GetUpdateCommand()
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_UsuariosUpdate]";
	
			CreateParameters(cmd);
			      
			return cmd;
		}
	
		protected override IDbCommand GetDeleteCommand()
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_UsuariosDelete]";
	
			SqlParameter p;
			p = cmd.Parameters.Add(Parameters.Id_usr);
			p.SourceColumn = ColumnNames.Id_usr;
			p.SourceVersion = DataRowVersion.Current;

  
			return cmd;
		}
		
		private IDbCommand CreateParameters(SqlCommand cmd)
		{
			SqlParameter p;
		
			p = cmd.Parameters.Add(Parameters.Id_usr);
			p.SourceColumn = ColumnNames.Id_usr;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Des_usr);
			p.SourceColumn = ColumnNames.Des_usr;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Grp_usr);
			p.SourceColumn = ColumnNames.Grp_usr;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Nom_usr);
			p.SourceColumn = ColumnNames.Nom_usr;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Estado);
			p.SourceColumn = ColumnNames.Estado;
			p.SourceVersion = DataRowVersion.Current;


			return cmd;
		}
	}
}
